home *** CD-ROM | disk | FTP | other *** search
/ Amiga Magazin: Amiga-CD 1997 November & December / Amiga-CD 1997 #11-12.iso / pd-disketten / ungepackt / 4_96 / apd-4-96-2 / pgpmanager / mm_pgpmanager0.8.rexx < prev    next >
OS/2 REXX Batch file  |  1996-01-26  |  20KB  |  596 lines

  1. /*
  2.  
  3.     MM_PGPManager
  4.  
  5.     1995 by Sebastian Bleikamp ...
  6.  
  7.     V. 0.8
  8.  
  9.  
  10.  
  11.  
  12.    This program is free to everyone  !
  13.  
  14.    USE IT AT YOUR OWN RISC !!!
  15.  
  16.  
  17.  
  18.     Neu seit Version 0.1:
  19.  
  20.       + Globale Variablennamen geändert.
  21.  
  22.       + -> GetKeys : Fügt alle Keys aus einer Message zum Public-Key
  23.                      Ring dazu. (Wenn es der User bestaetigt... )
  24.  
  25.       + -> Save    : Entschlüsselt eine Nachricht und speichert sie dann als Klartext in die
  26.                      Msg.-Base.
  27.  
  28.     Neu seit Version 0.2:
  29.  
  30.       + E-Mails werden erkannt, und die Adressierung berücksichtigt.
  31.         Dazu wurden 2 Funktionen geschrieben: Get_MM_Msg und Edit_MM_Msg.
  32.         Sie lesen (wenn vorhanden) die E-Mail Adresse aus und schreiben sie nacher
  33.         wieder als 1. Zeile in die Msg.
  34.  
  35.     Neu seit Version 0.3:
  36.  
  37.       + Es gibt jetzt 2 Funktionen zum Verschluesseln der Messages:
  38.         Einmal wird die Message nur verschluesselt (WRITE) und bei der
  39.         anderen zusätzlich noch unterschrieben (WRITES)
  40.  
  41.       + Alle Texte jetzt in Englisch (außer den Docs ...)
  42.  
  43.       + Endlich:
  44.         Jetzt mit Doks !!!
  45.  
  46.  
  47.     Neu seit Version 0.4:
  48.  
  49.       + Funktion PUTFILE:
  50.         Verschlüsselt ein File (auch binär) und hängt es im ASCII Format
  51.         an eine Message an.
  52.  
  53.       + Funktion GETFILE:
  54.         Speichert den Plaintext einer Message in ein File.
  55.         Sehr nützlich, wenn man verschlüsselte Binärfiles empfängt.
  56.  
  57.  
  58.     Neu seit Version 0.5 (nicht veröffentlicht):
  59.  
  60.       + Jetzt mit Requester, der die Public-Keys auflistet.
  61.         Wenn Abbruch eingegeben wird, kann man die User-ID per
  62.         Hand eingeben.
  63.  
  64.       + Jetzt mit GUI. Einfach spitze !!!
  65.  
  66.       + Jetzt mit Sicherheitsabfrage, wenn Messages bereits gesendet wurden,
  67.         importiert oder geschützt sind.
  68.  
  69.  
  70.     Neu seit Version 0.6 (nicht veröffentlicht):
  71.  
  72.       + Bug in der Funktion für die Public-Keyliste entfernt.
  73.         Routine optimiert.
  74.  
  75.       + Remove:
  76.         Beseitigt die Signature vom File, funktioniert wie SAVE.
  77.  
  78.       + Jetzt mit Verschlüsseln für mehrere User !!!
  79.  
  80.  
  81.      Neu seit Version 0.7:
  82.  
  83.       + Bessere Konfiguration.
  84.  
  85.       + Einige Bugs beseitigt, läuft jetzt zuverlässiger.
  86.         (Hoffentlich ...)
  87. */
  88.  
  89.  
  90. ADDRESS 'MAILMANAGER'
  91. PARSE ARG system.area system.msg system.funk
  92.  
  93.  
  94.                             /* Configuration */
  95. /*---------------------------------------------------------------------------*/
  96.  
  97.  
  98. /* Die PGP Befehle:
  99.  
  100.     Am besten nur die Pfade und die CON: verändern !
  101.     Meine Empfehlung für CON:
  102.  
  103.     CON:0/11/-1/245/PGP/SCREEN<MailManagerScreen>
  104.  
  105. */
  106.  
  107.  
  108. system.pgp.read       = 'PGP <>CON: -m'
  109. system.pgp.write      = 'PGP <>CON: -eat'
  110. system.pgp.write_sign = 'PGP <>CON: -seat'
  111. system.pgp.sign       = 'PGP <>CON: -sat'
  112. system.pgp.keyadd     = 'PGP <>CON: -kxat'
  113. system.pgp.getkeys    = 'PGP <>CON: -ka'
  114. system.pgp.save       = 'PGP <>CON: -d'
  115. system.pgp.getfile    = 'PGP <>CON: -p'
  116. system.pgp.putfile    = 'PGP <>CON: -ea'
  117. system.pgp.remove     = 'PGP <>CON: -b'
  118. system.pgp.listkeys   = 'PGP -kv'  /* Don´t use a <>CON: here !!! */
  119.  
  120. system.sysopid      =   'It´s me !!!'  /* Your id in PGP´s secret ring */
  121. system.output       =   'T:Output'
  122. system.tempfile     =   'T:MM_PGPM.tmp'
  123.  
  124.  
  125.  
  126.  
  127. /*-----------------------------------------------------------------------*/
  128. /* Init:                                                                 */
  129. /*-----------------------------------------------------------------------*/
  130.  
  131. system.output.asc   =   system.output||'.asc'
  132. system.output.sig   =   system.output||'.sig'
  133. list.count=0
  134.  
  135. /*-----------------------------------------------------------------------*/
  136. /* Main:                                                                 */
  137. /*-----------------------------------------------------------------------*/
  138.  
  139.  
  140.  
  141. if system.funk='GUI' | system.funk=''
  142.   then system.leave=0
  143.   else system.leave=1
  144.  
  145.  
  146. Main:
  147.     do while system.leave~=2
  148.         if system.leave=0 then do
  149.             system.funk=''
  150.             call Get_Mode
  151.         end
  152.         else system.leave=2
  153.  
  154.         SELECT
  155.             WHEN UPPER(system.funk)='READ'    THEN CALL PGP_Read
  156.             WHEN UPPER(system.funk)='WRITE'   THEN CALL PGP_Write
  157.             WHEN UPPER(system.funk)='WRITES'  THEN CALL PGP_Write_Sign
  158.             WHEN UPPER(system.funk)='SIGN'    THEN CALL PGP_Sign
  159.             WHEN UPPER(system.funk)='KEYADD'  THEN CALL PGP_Keyadd
  160.             WHEN UPPER(system.funk)='GETKEYS' THEN CALL PGP_GetKeys
  161.             WHEN UPPER(system.funk)='SAVE'    THEN CALL PGP_Save
  162.             WHEN UPPER(system.funk)='GETFILE' THEN CALL PGP_GetFile
  163.             WHEN UPPER(system.funk)='PUTFILE' THEN CALL PGP_PutFile
  164.             WHEN UPPER(system.funk)='REMOVE'  THEN CALL PGP_Remove
  165.             WHEN UPPER(system.funk)='HELP'    THEN CALL Prog_Help
  166.             OTHERWISE CALL Prog_Help
  167.         END
  168.     end
  169.     exit
  170. return
  171.  
  172.  
  173.  
  174.  
  175. /*-----------------------------------------------------------------------*/
  176. /* Read / Write Functions:                                               */
  177. /*-----------------------------------------------------------------------*/
  178.  
  179. PGP_Read:
  180.  
  181.     drop MSG_Stem.
  182.     MM_ReadMsg system.area system.msg 'MSG_Stem' ; IF RC~=0 THEN exit
  183.     MM_WriteStem system.tempfile MSG_Stem.TEXT
  184.     ADDRESS command system.pgp.read||' '|| system.tempfile
  185.     MM_DeleteFile system.tempfile
  186.  
  187. RETURN
  188.  
  189.  
  190. PGP_Write:
  191.  
  192.     drop MSG_Stem.
  193.     MM_ReadMsg system.area system.msg 'MSG_Stem' ; IF RC~=0 THEN exit
  194.     REQTEXT='  Area: '||system.area||'0a'X ||'  Msg.: '||system.msg||'0a'X ||'0a'X ||'  Subj: '||MSG_Stem.Subj||'0a'X ||'0a'X ||'0a'X ||'  From: '||MSG_Stem.From||'0a'X ||'        ('||MSG_Stem.Fromaddr||')'||'0a'X ||'0a'X ||'    To: '||MSG_Stem.To||'0a'X ||'        ('||MSG_Stem.Toaddr||')'||'0a'X ||'0a'X ||'0a'X ||'          Do you want to encrypt this message ?          ' ; GADGETS='*   _Yes   |   _No   '
  195.     MM_Requester '"MM_PGPManager: Write"' 'REQTEXT' 'GADGETS'
  196.     IF RC~=1 THEN return
  197.  
  198.     call Check_Write
  199.  
  200.     user = MSG_Stem.TO
  201.     call Get_Multi_User
  202.  
  203.     CALL Get_MM_Msg
  204.     ADDRESS COMMAND system.pgp.write||' -o '||system.output||' '||system.tempfile || ' ' ||user
  205.     CALL Edit_MM_Msg
  206.  
  207.     MM_EditMsg system.area system.msg 'MSG_Stem'
  208.     MM_DeleteFile system.tempfile
  209.     MM_DeleteFile system.output.asc
  210.  
  211. RETURN
  212.  
  213. PGP_Write_Sign:
  214.  
  215.     drop MSG_Stem.
  216.     MM_ReadMsg system.area system.msg 'MSG_Stem' ; IF RC~=0 THEN exit
  217.  
  218.     REQTEXT='  Area: '||system.area||'0a'X ||'  Msg.: '||system.msg||'0a'X ||'0a'X ||'  Subj: '||MSG_Stem.Subj||'0a'X ||'0a'X ||'0a'X ||'  From: '||MSG_Stem.From||'0a'X ||'        ('||MSG_Stem.Fromaddr||')'||'0a'X ||'0a'X ||'    To: '||MSG_Stem.To||'0a'X ||'        ('||MSG_Stem.Toaddr||')'||'0a'X ||'0a'X ||'0a'X ||'   Do you really want to sign and encrypt this msg. ?    ' ; GADGETS='*   _Yes   |   _No   '
  219.     MM_Requester '"MM_PGPManager: Write & Sign"' 'REQTEXT' 'GADGETS'
  220.     IF RC~=1 THEN return
  221.  
  222.     call Check_Write
  223.  
  224.     REQTEXT= '"Please enter the sysop´s user id:"'
  225.     MM_StringReq REQTEXT 'system.sysopid'
  226.     if rc~=0 then return
  227.  
  228.     user = MSG_Stem.TO
  229.     call Get_Multi_User
  230.  
  231.     CALL Get_MM_Msg
  232.     ADDRESS COMMAND system.pgp.write_sign||' -o '||system.output||' -u "'||system.sysopid||'"  '||system.tempfile||' '||user
  233.     CALL Edit_MM_Msg
  234.  
  235.     MM_EditMsg system.area system.msg 'MSG_Stem'
  236.     MM_DeleteFile system.tempfile
  237.     MM_DeleteFile system.output.asc
  238.  
  239. RETURN
  240.  
  241.  
  242.  
  243. PGP_Sign:
  244.  
  245.     drop MSG_Stem.
  246.     MM_ReadMsg system.area system.msg 'MSG_Stem' ; IF RC~=0 THEN exit
  247.  
  248.     REQTEXT='  Area: '||system.area||'0a'X ||'  Msg.: '||system.msg||'0a'X ||'0a'X ||'  Subj: '||MSG_Stem.Subj||'0a'X ||'0a'X ||'0a'X ||'  From: '||MSG_Stem.From||'0a'X ||'        ('||MSG_Stem.Fromaddr||')'||'0a'X ||'0a'X ||'    To: '||MSG_Stem.To||'0a'X ||'        ('||MSG_Stem.Toaddr||')'||'0a'X ||'0a'X ||'0a'X ||'        Do you really want to sign this message ?        ' ; GADGETS='*   _Yes   |   _No   '
  249.     MM_Requester '"MM_PGPManager: Sign"' 'REQTEXT' 'GADGETS'
  250.     IF RC~=1 THEN return
  251.  
  252.     call Check_Write
  253.  
  254.     REQTEXT= '"Please enter the sysop´s user id:"'
  255.     MM_StringReq REQTEXT 'system.sysopid'
  256.     if RC~=0 then return
  257.  
  258.     CALL Get_MM_Msg
  259.     ADDRESS command system.pgp.sign||' -o '||system.output||' -u "'||system.sysopid||'" '||system.tempfile
  260.     CALL Edit_MM_Msg
  261.  
  262.     MM_EditMsg system.area system.msg 'MSG_Stem'
  263.     MM_DeleteFile system.tempfile
  264.     MM_DeleteFile system.output.asc
  265.  
  266. RETURN
  267.  
  268.  
  269. PGP_Keyadd:
  270.  
  271.     drop MSG_Stem.
  272.     MM_ReadMsg system.area system.msg 'MSG_Stem' ; IF RC~=0 THEN exit
  273.  
  274.     REQTEXT='  Area: '||system.area||'0a'X ||'  Msg.: '||system.msg||'0a'X ||'0a'X ||'  Subj: '||MSG_Stem.Subj||'0a'X ||'0a'X ||'0a'X ||'  From: '||MSG_Stem.From||'0a'X ||'        ('||MSG_Stem.Fromaddr||')'||'0a'X ||'0a'X ||'    To: '||MSG_Stem.To||'0a'X ||'        ('||MSG_Stem.Toaddr||')'||'0a'X ||'0a'X ||'0a'X ||'          Do you really want to add a keyfile ?          ' ; GADGETS='*   _Yes   |   _No   '
  275.     MM_Requester '"MM_PGPManager: Add Key"' 'REQTEXT' 'GADGETS'
  276.     IF RC~=1 THEN return
  277.  
  278.     call Check_Write
  279.  
  280.     user = system.sysopid
  281.     call Get_User
  282.  
  283.     ADDRESS command system.pgp.keyadd||' '||user||' '||system.output
  284.     MM_ReadStem system.output.asc 'MSG_Stem.TEXT' 'APPEND'
  285.     MM_WriteStem system.tempfile 'MSG_Stem.TEXT'
  286.  
  287.     MSG_Stem.FILE = system.tempfile
  288.     MM_EditMsg system.area system.msg 'MSG_Stem'
  289.     MM_DeleteFile system.tempfile
  290.     MM_DeleteFile system.output.asc
  291.  
  292. RETURN
  293.  
  294.  
  295. PGP_GetKeys:
  296.  
  297.     drop MSG_Stem.
  298.     MM_ReadMsg system.area system.msg 'MSG_Stem' ; IF RC~=0 THEN exit
  299.     MM_WriteStem system.tempfile MSG_Stem.TEXT
  300.     ADDRESS command system.pgp.getkeys||' '||system.tempfile
  301.     MM_DeleteFile system.tempfile
  302.  
  303. RETURN
  304.  
  305.  
  306. PGP_Save:
  307.  
  308.     drop MSG_Stem.
  309.     MM_ReadMsg system.area system.msg 'MSG_Stem' ; IF RC~=0 THEN exit
  310.  
  311.     REQTEXT='  Area: '||system.area||'0a'X ||'  Msg.: '||system.msg||'0a'X ||'0a'X ||'  Subj: '||MSG_Stem.Subj||'0a'X ||'0a'X ||'0a'X ||'  From: '||MSG_Stem.From||'0a'X ||'        ('||MSG_Stem.Fromaddr||')'||'0a'X ||'0a'X ||'    To: '||MSG_Stem.To||'0a'X ||'        ('||MSG_Stem.Toaddr||')'||'0a'X ||'0a'X ||'0a'X ||'       Do you really want to save the plaintext ?       '||'0a'X ||'                  (Orig. msg gets lost!) ' ; GADGETS='   _Yes   |*   _No   '
  312.     MM_Requester '"MM_PGPManager: Save"' 'REQTEXT' 'GADGETS'
  313.     IF RC~=1 THEN return
  314.     
  315.     if find(MSG_Stem.FLAGS, 'SAFE')~=0
  316.     then do
  317.         REQTEXT='          WARNING:'||'0a'X ||'0a'X ||'  The message is protected.  ' ; GADGETS='*   _Continue   |   _Ooops !!!   '
  318.         MM_Requester 'MM_PGPManager' 'REQTEXT' 'GADGETS'
  319.         IF RC~=1 THEN return
  320.     end
  321.  
  322.     MM_WriteStem system.tempfile MSG_Stem.TEXT
  323.     ADDRESS command system.pgp.save||' -o '||system.output.asc||' '||system.tempfile
  324.     MSG_Stem.FILE = system.output.asc
  325.     MM_EditMsg system.area system.msg 'MSG_Stem'
  326.     MM_DeleteFile system.tempfile
  327.     MM_DeleteFile system.output.asc
  328.  
  329. RETURN
  330.  
  331.  
  332. PGP_GetFile:
  333.  
  334.     drop MSG_Stem.
  335.     MM_ReadMsg system.area system.msg 'MSG_Stem' ; IF RC~=0 THEN exit
  336.     MM_WriteStem system.tempfile MSG_Stem.TEXT
  337.     outfile=system.output
  338.     MM_FileReq 'outfile' ; if rc=1 then return
  339.     ADDRESS command system.pgp.getfile||' -o '||outfile||' '||system.tempfile
  340.     MM_DeleteFile system.tempfile
  341.  
  342. RETURN
  343.  
  344.  
  345. PGP_PutFile:
  346.     drop MSG_Stem.
  347.     MM_ReadMsg system.area system.msg 'MSG_Stem' ; IF RC~=0 THEN exit
  348.  
  349.     REQTEXT='  Area: '||system.area||'0a'X ||'  Msg.: '||system.msg||'0a'X ||'0a'X ||'  Subj: '||MSG_Stem.Subj||'0a'X ||'0a'X ||'0a'X ||'  From: '||MSG_Stem.From||'0a'X ||'        ('||MSG_Stem.Fromaddr||')'||'0a'X ||'0a'X ||'    To: '||MSG_Stem.To||'0a'X ||'        ('||MSG_Stem.Toaddr||')'||'0a'X ||'0a'X ||'0a'X ||'       Do you want to encrypt and append a file ?       ' ; GADGETS='*   _Yes   |   _No   '
  350.     MM_Requester '"MM_PGPManager: Put File"' 'REQTEXT' 'GADGETS'
  351.     IF RC~=1 THEN return
  352.  
  353.     call Check_Write
  354.  
  355.     infile='RAM:'
  356.     MM_FileReq 'infile' ; if rc=1 then return
  357.  
  358.     user = MSG_Stem.TO
  359.     call Get_Multi_User
  360.  
  361.     ADDRESS command system.pgp.putfile||' -o '||system.output||' '||infile||' '||user
  362.     MM_ReadStem system.output.asc 'MSG_Stem.TEXT' 'APPEND'
  363.     MM_WriteStem system.tempfile 'MSG_Stem.TEXT'
  364.  
  365.     MSG_Stem.FILE = system.tempfile
  366.     MM_EditMsg system.area system.msg 'MSG_Stem'
  367.     MM_DeleteFile system.tempfile
  368.     MM_DeleteFile system.output.asc
  369.  
  370. RETURN
  371.  
  372.  
  373. PGP_Remove:
  374.  
  375.     drop MSG_Stem.
  376.     MM_ReadMsg system.area system.msg 'MSG_Stem' ; IF RC~=0 THEN exit
  377.  
  378.     MM_WriteStem system.tempfile MSG_Stem.TEXT
  379.     ADDRESS command system.pgp.remove||' -o '||system.output.asc||' '||system.tempfile
  380.  
  381.     REQTEXT='  Do you want to write the message to the message base ?  '||'0a'X ||'0a'X ||'           The signature has been removed.'||'0a'X ||'0a'X ||'         WARNING: Orig. message gets lost !'
  382.     GADGETS='   _Yes   |*   _No   '
  383.     MM_Requester '"MM_PGPManager: Remove"' 'REQTEXT' 'GADGETS'
  384.     IF RC=1 THEN do
  385.         if find(MSG_Stem.FLAGS, 'SAFE')~=0
  386.         then do
  387.             REQTEXT='          WARNING:'||'0a'X ||'0a'X ||'  The message is protected.  ' ; GADGETS='*   _Continue   |   _Ooops !!!   '
  388.             MM_Requester 'MM_PGPManager' 'REQTEXT' 'GADGETS'
  389.             IF RC~=1 THEN return
  390.         end
  391.  
  392.         MSG_Stem.FILE = system.output.asc
  393.         MM_EditMsg system.area system.msg 'MSG_Stem'
  394.         MM_DeleteFile system.tempfile
  395.         MM_DeleteFile system.output.asc
  396.     end
  397.     else do
  398.         outfile='RAM:Message.asc'
  399.         MM_FileReq 'outfile'
  400.         MM_MoveFile system.output.asc outfile
  401.     end
  402.  
  403.     REQTEXT='  The Signature is saved in a file.  '||'0a'X ||'0a'X ||'      Do you want to delete it ? '
  404.     GADGETS='*    _Yes    |    _No     '
  405.     MM_Requester '"MM_PGPManager: Remove"' 'REQTEXT' 'GADGETS'
  406.     IF RC=1 THEN MM_DeleteFile system.output.sig
  407.     else do
  408.         outfile='RAM:Message.sig'
  409.         MM_FileReq 'outfile'
  410.         MM_MoveFile system.output.sig outfile
  411.     end
  412. return
  413.  
  414.  
  415.  
  416. /*-----------------------------------------------------------------------*/
  417. /* Misc Functions & Subroutines:                                         */
  418. /*-----------------------------------------------------------------------*/
  419.  
  420.  
  421.  
  422. Get_MM_Msg:
  423.     IF ( UPPER(Word( MSG_Stem.TEXT.0, 1)) = 'TO:' ) THEN DO
  424.         system.email = MSG_Stem.TEXT.0
  425.         DO i = 2 TO MSG_Stem.TEXT.COUNT-1
  426.             j = i - 2
  427.             text.j = MSG_Stem.TEXT.i
  428.         END
  429.         text.count = MSG_Stem.TEXT.COUNT-2
  430.         MM_WriteStem system.tempfile 'text'
  431.      END
  432.      ELSE DO
  433.         system.email = ''
  434.         MM_WriteStem system.tempfile 'MSG_Stem.TEXT'
  435.      END
  436. RETURN
  437.  
  438. Edit_MM_Msg:
  439.     IF system.email='' THEN DO
  440.         MSG_Stem.FILE = system.output.asc
  441.     END
  442.     ELSE DO
  443.         text.count=2
  444.         text.0 = system.email
  445.         text.1 = ''
  446.         MM_ReadStem system.output.asc 'text' 'APPEND'
  447.         MM_WriteStem system.tempfile 'text'
  448.         MSG_Stem.FILE= system.tempfile
  449.     END
  450. RETURN
  451.  
  452.  
  453.  
  454. Get_User:
  455.     call Read_List
  456.     dummy.count=0
  457.     REQTEXT= '"Please enter the user id of the public key:"'
  458.     MM_SingleSelReq 'list' 'dummy' REQTEXT 'STR'
  459.     if rc=0 then do
  460.         user=''
  461.         user=dummy.0
  462.     end
  463.     else do
  464.         REQTEXT= '"Please enter the user id of the public key:"'
  465.         MM_StringReq REQTEXT 'user' ; if rc~=0 then exit
  466.     end
  467.     user= '"'||user||'"'
  468. return
  469.  
  470. Get_Multi_User:
  471.     call Read_List
  472.     dummy.count=0
  473.     REQTEXT= '"Please enter the user id of the public key:"'
  474.     MM_MultiSelReq 'list' 'dummy' REQTEXT 'STR'
  475.     if rc=0 then do
  476.         user=''
  477.         do x=0 to dummy.count-1
  478.             user= user||'"'||dummy.x||'" '
  479.         end
  480.     end
  481.     else do
  482.         REQTEXT= '"Please enter the user id of the public key:"'
  483.         MM_StringReq REQTEXT 'user' ; if rc~=0 then exit
  484.         user='"'||user|'"'
  485.     end
  486. return
  487.  
  488.  
  489. Read_List:
  490.     dummy.count=0
  491.     if list.count=0 then do
  492.         address command system.pgp.listkeys||' >'||system.tempfile
  493.         MM_ReadStem system.tempfile 'dummy'
  494.         do x=0 to dummy.count-1
  495.             parse var dummy.x 'pub  ' . ' ' . '  ' name
  496.             if name~='' then do
  497.                 y=list.count; list.y=name; list.count=y+1; end
  498.         end
  499.     end
  500. return
  501.  
  502.  
  503. Check_Write:
  504.     if find(MSG_Stem.FLAGS, 'SENT')~=0 | find(MSG_Stem.FLAGS, 'IMP')~=0 | find(MSG_Stem.FLAGS, 'SAFE')~=0
  505.     then do
  506.         REQTEXT='                      WARNING:'||'0a'X ||'0a'X ||'  The message is protected, imported or already sent.  ' ; GADGETS='*   _Continue   |   _Ooops !!!   '
  507.         MM_Requester 'MM_PGPManager' 'REQTEXT' 'GADGETS'
  508.         IF RC=0 THEN exit
  509.     end
  510. return
  511.  
  512.  
  513.  
  514. Get_Mode:
  515.     do while system.funk=''
  516.         reqtext='   Please select a mode:   '
  517.         reqgadgets='*    _Read    |    _Write   |    _Help    |    _Quit    '
  518.         MM_Requester '"MM_PGPManager: Main Menu"' 'reqtext' 'reqgadgets'
  519.         mode=rc
  520.         select
  521.             when mode=1 then call Get_Mode_Read
  522.             when mode=2 then call Get_Mode_Write
  523.             when mode=3 then call Prog_Help
  524.             otherwise exit
  525.         end
  526.     end
  527. return
  528.  
  529.  
  530. Get_Mode_Read:
  531.     reqtext='   Please select a function:   '
  532.     reqgadgets='* _Read | Get _File | _Get Keys | _Save |_Remove Sig.| _Back '
  533.     MM_Requester '"MM_PGPManager: Read"' 'reqtext' 'reqgadgets'
  534.     func=rc
  535.     select
  536.         when func=1 then system.funk='READ'
  537.         when func=2 then system.funk='GETFILE'
  538.         when func=3 then system.funk='GETKEYS'
  539.         when func=4 then system.funk='SAVE'
  540.         when func=5 then system.funk='REMOVE'
  541.         otherwise return
  542.     end
  543. return
  544.  
  545.  
  546. Get_Mode_Write:
  547.     reqtext='   Please select a function:   '
  548.     reqgadgets='  _Write  | _Sign |W_rite&Sign|_Put File|_Add Key|* _Back '
  549.     MM_Requester '"MM_PGPManager:  Write"' 'reqtext' 'reqgadgets'
  550.     func=rc
  551.     select
  552.         when func=1 then system.funk='WRITE'
  553.         when func=2 then system.funk='SIGN'
  554.         when func=3 then system.funk='WRITES'
  555.         when func=4 then system.funk='PUTFILE'
  556.         when func=5 then system.funk='KEYADD'
  557.         otherwise return
  558.     end
  559. return
  560.  
  561.  
  562.  
  563. /*-----------------------------------------------------------------------*/
  564. /* Help:                                                                 */
  565. /*-----------------------------------------------------------------------*/
  566.  
  567.  
  568. Prog_Help:
  569.     mydummy=0
  570.     do while mydummy=0
  571.         reqtext='     MM_PGPManager'||'0a'X ||'0a'X ||'      Version 0.8'||'0a'X ||'0a'X ||'1996 by Sebastian Bleikamp'||'0a'X ||'0a'X ||'0a'X ||'Please choose the topic:'
  572.         reqgadgets='   _Read   |   _Write   |*   _Back   '
  573.         MM_Requester '"MM_PGPManager: Help"' 'reqtext' 'reqgadgets'
  574.         mode=rc
  575.         select
  576.             when mode=1 then call read_help
  577.             when mode=2 then call write_help
  578.             otherwise mydummy=1
  579.         end
  580.     end
  581. return
  582.  
  583.  
  584. read_help:
  585.     reqtext='Read     - Decrypt and read a message'||'0a'X ||'           using PGP´s viewer.'||'0a'X ||'0a'X ||'Get File - Write decrypted message to a file.'||'0a'X ||'           Useful for receiving binary files.'||'0a'X ||'0a'X ||'Get Keys - Get all keys out of a message'||'0a'X ||'           reading it.'||'0a'X ||'0a'X ||'Save     - Save the plaintext of the message'||'0a'X ||'           to the message base.'||'0a'X ||'           Encrypted msg. will be killed !'||'0a'X ||'0a'X ||'Remove   - Removes signatures from message.'||'0a'X ||'           (Message will be decrypted,'||'0a'X ||'           orig. message gets lost !)'
  586.     reqgadgets='*_Back to the help menu.'
  587.     MM_Requester '"MM_PGPManager: Help - Read"' 'reqtext' 'reqgadgets'
  588. return
  589.  
  590. write_help:
  591.     reqtext='Write        - Encrypt the current message.'||'0a'X ||'0a'X ||'Sign         - Sign the current message.'||'0a'X ||'0a'X ||'Write & Sign - Encrypt and sign the current'||'0a'X ||'               message.'||'0a'X ||'0a'X ||'Put File     - Encrypt a file, including binary'||'0a'X ||'               files, and append it to the'||'0a'X ||'               current message.'||'0a'X ||'0a'X ||'Add Key      - Add a public key from the pubring'||'0a'X ||'               to the message.'
  592.     reqgadgets='*_Back to the help menu.'
  593.     MM_Requester '"MM_PGPManager: Help - Write"' 'reqtext' 'reqgadgets'
  594. return
  595.  
  596.